<?php
declare (strict_types = 1);

namespace app\home\controller;

use think\facade\View;
use think\facade\Db;
class Home
{
    //首页
    public function index()
    {

        return View::fetch();
    }
    //登录页
    public function login()
    {

        return View::fetch();
    }
    //注册页
    public function register()
    {

        return View::fetch();
    }
    //交流专区
    public function forum()
    {

        return View::fetch();
    }
    //插件专区
    public function plugin()
    {

        return View::fetch();
    }
    //个人中心
    public function userSet()
    {

        return View::fetch();
    }
    //检测授权
    public function check_auth(){

        if(request()->isAjax()){
            //根据域名或授权码查询授权信息
            $auth_code = input('auth_code');
            $auth_info = Db::name('auth_domain')->where('domain|auth_code','=',$auth_code)->find();
            if($auth_info){
                //返回授权信息，包含授权域名，授权主体信息，备案号
                return json(['status'=>1,'msg'=>'查询成功','data'=>$auth_info]);
            }else{
                return json(['status'=>0,'msg'=>'未查询到授权信息']);
            }
        }else{
            return View::fetch();
        }
    }
    public function download(){
        if(request()->isAjax()){
            $download_url = '/install.zip';
            return json(['status'=>1,'msg'=>'查询成功','data'=>['download_url'=>$download_url]]);
        }
    }
}
